<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var num = prompt("请输入一个数字");

      isZhi(num);

      function isZhi(n) {
        var count = 0;
        for (var i = 1; i <= n; i++) {
          if (n % i == 0) {
            count++;
          }
        }
        return count == 2;
        // if (count == 2) {
        //   return true;
        // } else {
        //   return false;
        // }
      }
    </script>
  </body>
</html>
